package cn.tedu.all.contrller;

import cn.tedu.all.service.OrderService;
import cn.tedu.pojo.param.OrderAddParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import result.JsonResult;

@RestController
public class OrderController {
    @Autowired
    private OrderService orderService;

    //新增订单
    @PostMapping("/order/add")
    public JsonResult addOrder(OrderAddParam orderAddParam) {
        //调用业务层逻辑
        Boolean result = orderService.addOrder(orderAddParam);
        if (!result) {
            return JsonResult.fail("failed");
        }
        return JsonResult.ok("ok");
    }
}
